/*
 * Master_Controller.h
 *
 * Created: 6/3/2013 9:11:40 PM
 *  Author: Crossfire
 */ 

#ifndef MASTER_CONTROLLER_H_
#define MASTER_CONTROLLER_H_

#define F_CPU 1000000
#define TJUNCTION 0x20
#define CROSSROAD 0x30

#include <avr/io.h>
#include <util/delay.h>

int _received_data_from_Uart, _timeout;
uint8_t _modus, _data_array[57], _receive, _modus_send;
unsigned char _address;

int main(void);
void Set_Streetlights(void);
void Set_Modus(void);
void GetUart(void);
void parse_received_data(uint8_t data);
void Send_Default_data(uint8_t address);
void Init(void);
void TWI_init_master(void);
void TWI_start(void);
void TWI_write_address(unsigned char data);
void TWI_write_data(unsigned char data);
void TWI_stop(void);
void TWI_Send(uint8_t data, uint8_t address);
void SERIAL_init(unsigned int baudrate);
int SERIAL_receiveByte(int timeout);
void SERIAL_sendByte(unsigned int byte);

#endif /* MASTER_CONTROLLER_H_ */